﻿package framework.net.post 
{
	import com.adobe.serialization.json.JSON;
	import flash.events.DataEvent;
	import flash.events.Event;
	import flash.external.ExternalInterface;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestHeader;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	import flash.utils.ByteArray;
	import flash.utils.clearInterval;
	import flash.utils.setInterval;
	import gs.plugins.VolumePlugin;

	/**
	 * 服务器
	 * @author fly
	 */
	public class Remoting  
	{
		private var _mid:int = 0;
		private var _gameTable:GameTable = null;
		private var _gameMember:GameMember = null;
		private var _gameGoods:GameProps = null;
		private var _geteway:String;
		private var _gamePhoto:GamePhoto = null;
		private var _tencent:GameTencent = null;
		private var _gameAuction:GameAuction = null;
		private var _gamefacebook:GameFaceBook = null;
		private var _gameTh:GameTh = null;
		private var _activity:Activity = null;
		
		// added by henrylee.  2012.7
		private var m_actionSrvProxy: GameActionCenter;
		private var m_trainingFieldProxy: GameTrainingBase;
		// add end  henrylee.  2012.7
		/**
		 * 构造
		 */
		public function Remoting(single:Single) 
		{
			_mid =  PlayerDataList.instance.selfData.uid;
		}
		
		public function syncServerTime():void
		{
			_gameMember.syncServerTime();
			
		}
		
		public function setTencentIndul():void
		{
			_gameMember.setTencentIndul();
		}
		
		/**
		 * 獲取團購信息
		 * */
		public function getGroupBuying():void
		{
			_tencent.getGroupBuying(); 
		}
		//團購商品
		public function buyGroupBuyingGood():void
		{
			_tencent.buyGroupBuyingGood();
		}
		public function buyGroupBuyingIpad():void
		{
			_tencent.buyGroupBuyingIpad();
		}
		
		public function setCode(arr:Array):void
		{
			_gameMember.setCode(arr);
		}
		public function checkCode(arr:Array):void
		{
			_gameMember.checkCode(arr);
		}
		public function resetCode(arr:Array):void
		{
			_gameMember.resetCode(arr);
		}
		public function checkAnswer(arr:Array):void
		{
			_gameMember.checkAnswer(arr);
		}
		public function repickPassword(arr:Array):void
		{
			_gameMember.repickPassword(arr);
		}
		public function getPwdQuestion():void
		{
			_gameMember.getPwdQuestion();
		}
		
		/**
		 * 獲取黃鉆每日登陸禮包
		 * */
		public function getVipDailyGift():void
		{
			_gameGoods.getVipDailyGift();
		}
		
		/**
		 * 獲取黃鉆升級禮包
		 * */
		public function getVipLevelUpPrize():void
		{
			_gameGoods.getVipLevelUpPrize();
		}
		
		public function getWeiBoGiftList():void
		{
			_gameGoods.getWeiBoGiftList();
		}
		public function getWeiboDailyPrize():void
		{
			_gameGoods.getWeiboDailyPrize();
		}
		
		/**
		 *  创建角色
		 * @param	sex
		 * @param	name
		 */
		public function create(sex:int,name:String,parts:String):void
		{
			_gameMember.create([name, sex, parts]);
		}
		
		/**
		 *  检测重名
		 * @param	str
		 */
		public function detectTautonomy(str:String):void
		{
			_gameMember.checkRepeatRole(str);
		}
			
		/**
		 * 获取用户信息，XML文件, 是否在断线列表中,
		 */
		public function LoadSelfData(aid:String):void
		{
			_gameMember.load(aid);
		}
		
		/**
		 *  购买
		 * @param	arr
		 */
		public function buy(arr:Array):void
		{
			if (GoodsList.instance.isFullKna(arr[0][1],arr[0][2]))
			{
				new Tiptext(LangManager.getLang.getLangByStr("full2"));
				EventCenter.GameEvent.dispatchEvent(new GameEvent(GameEvent.SENDSYSTEMINFO, LangManager.getLang.getLangByStr("full2") ));
				return;
			}
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().tobuy(0, arr);
			else
				_gameGoods.buy(arr);
		}
		
		/**
		 * 公会购买
		 * @param	arr
		 */
		public function unionBuy(arr:Array):void
		{
			if (GoodsList.instance.isFullKna(arr[0][1],arr[0][2]))
			{
				new Tiptext(LangManager.getLang.getLangByStr("full2"));
				EventCenter.GameEvent.dispatchEvent(new GameEvent(GameEvent.SENDSYSTEMINFO, LangManager.getLang.getLangByStr("full2") ));
				return;
			}
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().tobuy(1, arr);
			else
				_gameGoods.unionBuy(arr);
		}
		
		/**
		 * 騰訊平臺用博雅幣購買
		 * */
		public function tencentBuy(arr:Array):void
		{
			if (GoodsList.instance.isFullKna())
			{
				new Tiptext(LangManager.getLang.getLangByStr("full2"));
				EventCenter.GameEvent.dispatchEvent(new GameEvent(GameEvent.SENDSYSTEMINFO, LangManager.getLang.getLangByStr("full2") ));
				return;
			}
			_gameGoods.tencentBuy(arr);
		}
		
		/**
		 * 騰訊平臺用博雅幣購買多个
		 * */
		public function tencentBuyCar(arr:Array):void
		{
			if (GoodsList.instance.isFullKna())
			{
				new Tiptext(LangManager.getLang.getLangByStr("full2"));
				EventCenter.GameEvent.dispatchEvent(new GameEvent(GameEvent.SENDSYSTEMINFO, LangManager.getLang.getLangByStr("full2") ));
				return;
			}
			_gameGoods.tencentBuyCar(arr);
		}
		
		
		/**
		 * 查詢騰訊平臺上博雅幣餘額
		 * */
		//public function checkBalance():void
		//{
			//if (GlobalConfig.lanVersion == 1)
				//_gameGoods.checkBalance();
		//}
		
		/**
		 * 更新账户信息(腾讯以外的所有平台)
		 */
		public function checkAllBalance():void
		{
			//if(GlobalConfig.lanVersion != 1)
				_gameGoods.checkAllBalance();
		}
		
		/**
		 * 新手礼包
		 */
		public function getNewbiePresent(num:int):void
		{
			_gameGoods.newbiePresentProps(num);
		}
		
		/**
		 *  获取道具
		 */
		public function getSelfProps():void
		{
			_gameGoods.getMemProps();
		}
		
		public function updatePropsForexChange():void
		{
			_gameGoods.updatePropsForexChange();
		}
		
		/**
		 * 獲取被邀請人升級后的獎勵
		 * */
		public function getFriendUpGradePirze(did:int):void
		{
			_gameGoods.getFriendUpGradePirze(did);
		}
		
		/**
		 *  强化
		 * @param	arr
		 */
		public function toStrengthen(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().toStrengthen(arr);
			else
				_gameGoods.toStrengthen(arr);
		}
		
		/**
		 *  合成
		 * @param	arr
		 */
		public function toSynthesis(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().toSynthesis(arr);
			else
				_gameGoods.toSynthesis(arr);
		}
		
		/**
		 *  熔炼
		 * @param	arr
		 */
		public function toRongLian(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().toRongLian(arr);
			else
				_gameGoods.toRongLian(arr);
		}
		
		/**
		 *  转移
		 * @param	arr
		 */
		public function toTransfer(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().toTransfer(arr);
			else
				_gameGoods.toTransfer(arr);
		}
		
		/**
		 *  附魔或吸附
		 * @param	arr
		 */
		public function tofumoOrXifu(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().tofumoOrXifu(arr);
			else
				_gameGoods.tofumoOrXifu(arr);
		}
		
		/**
		 * 腾讯强9以上转移
		 * @param	arr
		 */
		public function toTransferTencent(arr:Array):void
		{
			_gameGoods.toTransferTencent(arr);
		}
		
		/**
		 *  重铸
		 * @param	arr
		 */
		public function onChongZhu(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().onChongZhu(arr);
			else
				_gameGoods.onChongZhu(arr);
		}
		
		/**
		 *  重铸覆盖属性 
		 * @param	int
		 */
		public function onChongZhuCover(num:int):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().onChongZhuCover(num);
			else
				_gameGoods.onChongZhuCover(num);
		}
		/**
		 *  装备卸载
		 * @param	arr
		 */
		public function setMemBody(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().setMemBody(arr);
			else
				_gameGoods.setMemBody(arr);
		}
		
		/**
		 *  切换装备位置 
		 * @param	arr
		 */
		public function setPackage(str:String):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().setPackage(str);
			else
				_gameGoods.setPackage(str);
		}
		
		/**
		 *  基本設計
		 * @param	str
		 * @param	type
		 */
		public function editBaseSetting(str:String,type:int):void
		{
			_gameGoods.editBaseSetting([str, type]);
		}
		
		/**
		 *  加好友
		 * @param	UID
		 */
		public function addFirend(UID:int):void
		{
			_gameMember.addFirend([UID]);
		}
		
		public function getFriendCount():void
		{
			_gameMember.getFriendCount();
		}
		
		/**
		 *  讀拜訪過的好友
		 */
		public function readVisitedFriend():void
		{
			_gameMember.readVisitedFriend();
		}
		
		/**
		 * 防沉迷验证
		 */
		public function indulgCheckHandle(nam: String, id: String):void
		{
			_gameMember.indulgeCheck(nam, id);
		}
		
		
		/**
		 *  获取好友
		 */
		public function readCompany():void
		{
			_gameMember.readCompany();
		}
		
		public function readPlatForm():void
		{
			_gameMember.readPlatForm();
		}
		
		public function searchFriend(mid:int, babyname:String):void
		{
			_gameMember.searchFriend(mid, babyname);
		}
		
		public function getOfflineMessage():void
		{
			_gameMember.getOfflineMessage();
		}
		
		
		/**
		 * 邀请好友拿礼物（台风活动）
		 */
		public function inviteGetGift():void
		{
			_gameMember.inviteGetGift();
		}
		
		/**
		 * 获取邀请好友的礼物（台风活动）
		 */
		public function getInvitePrize():void
		{
			_gameMember.getInvitePrize();
		}
		
		/**
		 *  设置在线
		 */
		public function setOnLine(type:int):void
		{
			_gameMember.setOnLine(type);
		}
		
		public function extractAttachment(arr:Array):void
		{
			_gameMember.extractAttachment(arr);
		}
		
		/**
		 *  读邮件
		 * @param	str
		 */
		public function readEmail(arr:Array):void
		{
			_gameMember.readEmail(arr);
		}
		
		/**
		 *  发送邮件
		 * @param	arr
		 */
		public function sendEmail(arr:Array):void
		{
			_gameMember.sendEmail(arr);
		}
		
		/**
		 *  删邮件
		 * @param	str
		 * @param	eid
		 */
		public function  deleteMail(arr:Array):void
		{
			_gameMember.deleteEmail(arr);
		}
		
		/**
		 *  设置以读
		 * @param	mailID
		 */
		public function setReaded(mailID:int):void
		{
			_gameMember.setReaded(mailID);
		}
		
		/**
		 *  获取服务器
		 */
		public function getServer(type:int):void
		{
			//_gameTable.getServer(type);
			IMSocketManager.getIMSocketManager().getServerID(type);
		}
		
		/**
		 *  快速进入
		 */
		public function fastStart(arr:Array):void
		{
			_gameTable.fastStart(arr);
		}
		
		/**
		 *  查找房间
		 * @param	room
		 */
		public function seekRoom(room:int):void
		{
			_gameTable.seekRoom([room]);
		}
		
		/**
		 *  續費
		 * @param	arr
		 */
		public function renew(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().renew(arr);
			else
				_gameGoods.renew(arr);
		}
		
		/**
		 * 騰訊平臺續費
		 * */
		public function tencentRenew(arr:Array):void
		{
			_gameGoods.tencentRenew(arr);
			//if (ExternalInterface.available)
			//{
				//ExternalInterface.call("renewProp", arr[0][1], arr[0][2]);
			//}
		
		}
		
		/**
		 *  出售
		 * @param	arr
		 */
		public function sellGoods(arr:Array):void
		{
			_gameGoods.sellGoods(arr);
		}
		
		/**
		 *  每日登錄領金幣
		 */
		public function sysSendMoney():void
		{
			_gameGoods.sysSendMoney();
		}
		
		/**
		 * 每日登录抽奖
		 */
		public function getLuckDraw():void
		{
			_gameMember.getLuckDraw();
		}
		
		/**
		 * 获取按等级排行的好友数据
		 */
		public function getLevelRank():void
		{
			_gameMember.getLevelRankList();
		}
		
		/**
		 * 获取周等级排行的好友数据
		 */
		public function getWeekLevelRank():void
		{
			_gameMember.getWeekLevelRank();
		}
		
		/**
		 * 获取日按等级排行的好友数据
		 */
		public function getDayLevelRank():void
		{
			_gameMember.getDayLevelRank();
		}
		
		/**
		 * 获取按战斗力排行的好友数据
		 */
		public function getFightRank():void
		{
			_gameMember.getFightRankList();
		}
		
		/**
		 * 获取周按战斗力排行的好友数据
		 */
		public function getWeekFightRank():void
		{
			_gameMember.getWeekFightRank();
		}
		
		/**
		 * 获取日按战斗力排行的好友数据
		 */
		public function getDayFightRank():void
		{
			_gameMember.getDayFightRank();
		}
		
		/**
		 *  打开礼包
		 */
		public function openGiftPack():void
		{
			_gameGoods.openGiftPack();
		}
		
		/**
		 * 消耗道具
		 */
		public function consumeProp(only:int):void
		{
			_gameGoods.consumeProp(only);
		}
		
		
		public function requestOfAddingFriend(uid:int):void
		{
			_gameMember.requestOfAddingFriend(uid);
		}
		
		public function respondToAddingFriend(arr:Array):void
		{
			_gameMember.respondToAddingFriend(arr);
		}
		
		/**
		 * 获得任务参数
		 */
		public function getMissionState():void
		{
			_gameTable.getMissionState();
		}
		
		public function gainReward(id:int,onlyid:Array):void
		{
			_gameTable.gainReward(id, onlyid);
		}
		
		//public function getDailyExcert():void
		//{
			//_gameTable.getDailyExcert();
		//}
	
		/**
		 *  連接錯誤
		 * @param	type
		 */
		public function gameLog(str:String):void
		{
			_gameMember.gameLog(str);
		}
		
		/**
		 *  訓練場獲取發光獎勵
		 */
		public function getTAProp():void
		{
			_gameMember.getTAProp();
		}
		
		/**
		 *  訓練場獎勵
		 */
		public function getTAPrize(sorce:Array):void
		{
			_gameMember.getTAPrize(sorce);
		}
		
		
		/**
		 *  訓練場獎勵
		 */
		public function getTAPrize1(sorce:int):void
		{
			_gameMember.getTAPrize1(sorce);
		}
		
		/**
		 * 改变用户信息
		 * @param	arr
		 */
		public function actRole(arr:Array):void
		{
			_gameGoods.actRole(arr);
		}
		
		
		/**
		 * 获得所有短信息 空字符串选所有日志/0留言/1拜访/2拿金币
		 * @param	obj
		 */
		public function getMessages(type:int):void
		{
			_gameTable.getMessages(type);
		}
		
		/**
		 * 获得单个短消息
		 * @param	msgID
		 */
		public function getSingleMessage(msgID:int):void
		{
			_gameTable.getSingleMessage(msgID);
		}
		
		/**
		 * 获取幸运大转盘物品
		 */
		public function getLuckRound():void
		{
			_gameTable.getLuckyRound();
		}
		
		/**
		 * 添加留言
		 * @param	msg
		 */
		public function addMessage(msg:Object):void
		{
			_gameTable.addMessage(msg);
		}
		
		/**
		 * 访问好友获得金币
		 */
		public function gainPremium(userID:int):void
		{
			_gameTable.gainPremium(userID);
		}
		
		/**
		 * 创建自己的家
		 */
		public function createHome(arr:Array):void
		{
			_gameTable.createHome(arr);
		}
		
		/**
		 * 获得家的数据
		 */
		public function getHomeData(userID:int):void
		{
			_gameTable.getHomeData(userID);
		}
		
		/**
		 * 拜访好友
		 * @param	userID
		 */
		public function visitFriend(userID:int):void
		{
			_gameTable.visitFriend(userID);
		}
		
		/**
		 * 日志新消息提醒
		 */
		public function getNews():void
		{
			_gameTable.getNews();
		}
		
		/**
		 *  更新等級
		 */
		public function updateGrade():void
		{
			_gameGoods.updateGrade();
		}
		
		/**
		 *  戰鬥翻牌獎勵
		 */
		public function getFightPrize(cardNum:int):void
		{
			var roomID:int = AllRoomData.instance.roomID;
			_gameGoods.getFightPrize([ roomID,cardNum]);
		}
		
		/**
		 *  在線時長領獎
		 */
		public function toOnlineReward():void
		{
			_gameGoods.toOnlineReward();
		}
		
		/**
		 *  獲取清單
		 */
		public function getDemandList():void
		{
			_gameGoods.getDemandList();
		}
		
		
		/**
		 *  設置清單
		 * @param	arr
		 */
		public function setDemandList(arr:Array):void
		{
			_gameGoods.setDemandList(arr);
		}
		
		//保存签到信息
		public function saveAttendanceRegister():void {
			_gameGoods.saveAttendanceRegister();
		}
		
		
		//得到签到信息
		public function getAttendanceRegister():void {
			_gameGoods.getAttendanceRegister();
		}
		
		//保存选择的星座套装
		public function saveSuitStid(stid:int):void {
			_gameGoods.saveSuitStid(stid);
		}
		
		//保存是否提醒双倍经验时间
		public function saveDoubleExperienceTime(value:int):void {
			_gameMember.saveDoubleExperienceTime(value);
		}
		
		/**
		 * 获取副本server
		 */
		public function getDuplicateServer():void
		{
			_gameTable.getDuplicateServer();
		}
		
		/**
		 * 获取聊天服务器ID
		 */
		public function getChatServerID(obj:Object):void
		{
			_gameTable.getChatServerID(obj);
		}
		
		//保存相片
		public function savePhoto(byteArr:ByteArray,arr:Array):void 
		{
			_gamePhoto.savePhoto(byteArr,arr);
		}
		
		/**
		 * 获取副本房间列表
		 * @param	obj{'difficulty':难度,'cpid':副本id,'pageno':页码}
		 */
		public function getDuplicateRoomList(obj:Object):void
		{
			//_gameTable.getDuplicateRoomList(obj);
			IMSocketManager.getIMSocketManager().getDuplicateRoomList(obj);
		}
		
		/**
		 * 获取公会自由战房间列表
		 * @param	obj{'pageno':页码}
		 */
		public function getFightRoomList(obj:Object):void
		{
			//_gameTable.getFightRoomList(obj);
			IMSocketManager.getIMSocketManager().getUnionFreewarList(obj.pageno);
		}
		
		
		//取晋级赛数据
		public function getMatch():void
		{
			_gameTable.getMatch();
		}
		
		//取周晉級賽
		public function getWeeklyMatch():void
		{
			_gameTable.getWeeklyMatch();
		}
		
		//進入周晉級賽房間
		public function enterWeeklyMatch():void
		{
			_gameTable.enterWeeklyMatch();
		}
		
		public function getWeeklyRaceGift():void
		{
			_gameTable.getWeeklyRaceGift();
		}
		
		//交报名费
		public function applicationFee(level:uint,type:uint):void
		{
			_gameTable.applicationFee(level,type);
		}
		
		/**
		 *  腾讯金币购买票
		 */
		public function txBuyTicket():void
		{
			_gameTable.txBuyTicket();
		}
		
		public function enterTxMatch():void
		{
			_gameTable.enterTxMatch()
		}

		
		//得到冠軍禮物
		public function getRaceGift(tid:int):void
		{
			_gameTable.getRaceGift(tid);
		}
		
		//取系统时间
		public function getDate():void
		{
			_gameMember.getDate();
		}
		
		//取系统时间
		public function getDate1():void
		{
			_gameMember.getDate1();
		}
		
		//獲取能量值
		public function getEnergy():void
		{
			_gameTable.getEnergy();
		}
		
		//检查玩家是否可以参加副本
		public function limitMemIn():void
		{
			_gameTable.limitMemIn();
		}
		
		/**
		 *  读通缉令好友奖励
		 */
		public function readWarrantComplete():void
		{
			_gameMember.readWarrantComplete();
		}
		
		/**
		 *  通缉名额
		 * @param	id
		 */
		public function setquota(id:int):void
		{
			_gameMember.setquota(id);
		}
		
		/**
		 *  通缉奖励
		 * @param	id
		 */
		public function getWarrantPrice(arr:Array):void
		{
			_gameMember.getWarrantPrice(arr);
		}
		
		/**
		 *  通缉人员
		 */
		public function getWarrantData():void
		{
			_gameMember.getWarrantData();
		}
		
		/**
		 *  61 活动
		 */
		//public function getFive5Info():void
		//{
			//_tencent.getFive5Info();
		//}
		
		/**
		 *  领奖
		 */
		//public function exchengeFive5(str:String):void
		//{
			//_tencent.exchengeFive5(str);
		//}

		
		//拿邮箱未读数目
		public function getMailNum():void
		{
			_gameMember.getMailNum();
		}
		
			//添加拍卖的物品
		public function addAuGoods(arr:Array):void
		{
			_gameAuction.addAuGoods(arr);
		}
		
		//获得某类拍卖的物品
		public function getaucteProps(arr:Array):void
		{
			_gameAuction.getaucteProps(arr);
		}
		
		// 获取用户拍卖的物品信息
		public function getMemAucteInfos():void
		{
			_gameAuction.getMemAucteInfos();
		}
		
		// 获取用户参加了竞拍的物品信息
		public function getMemBidInfos():void
		{
			_gameAuction.getMemBidInfos();
		}
		
		//  博雅币兑换拍卖币
		public function boyaa2auctecoin(num:int):void
		{
			_gameAuction.boyaa2auctecoin(num);
		}
		
		//  直接购买
		public function buyThrough(acid:int):void
		{
			_gameAuction.buyThrough(acid);
		}
		
		//  竞拍物品，物品加价
		public function addAuctePrice(arr:Array):void
		{
			_gameAuction.addAuctePrice(arr);
		}
		
		//  竞拍物品，物品加价
		public function cancelAuction(arr:Array):void
		{
			_gameAuction.canceAucte(arr);
		}
		
		
		//  刷新竞拍物品信息
		public function refreshaucteinfo(arr:Array):void
		{
			_gameAuction.refreshaucteinfo(arr);
		}
		
		/**
		 *  道具错误数据
		 */
		public function proplog():void
		{
			var arr:Array = PlayerDataList.instance.selfData.propToString().split(";");
			_gameGoods.proplog(arr);
		}
		
		// 获取coco可乐奖励
		public function getCOCOPrice(str:String):void
		{
			_gamefacebook.getCOCOPrice(str);
		}
		
		//去家里时拿鲜花
		public function getFlower():void
		{
			_gameTh.getFlower();
		}
		
		//得到鲜花
		public function getMoterDailyPrice(arr:Array):void
		{
			_gameTh.getMoterDailyPrice(arr);
		}
		
		//好友数
		public function getMinviteNum():void
		{
			_gameTh.getMinviteNum();
		}
		
		
		// 拿装备的道具
		public function getMemBody():void
		{
			_gameGoods.getMemBody();
		}
		
		/**
		 * 初始化
		 * @param	gateway
		 */
		public function init(gateway:String):void	
		{
			_geteway = gateway;
			_gameTable = new GameTable(gateway , _mid);
			_gameMember = new GameMember(gateway , _mid);
			_gameGoods = new GameProps(gateway, _mid);
			_gamePhoto = new GamePhoto(gateway, _mid);
			_tencent = new GameTencent(gateway, _mid);
			_gameAuction = new GameAuction(gateway, _mid);
			_gamefacebook = new GameFaceBook(gateway, _mid);
			_gameTh = new GameTh(gateway, _mid);
			_activity = new Activity(gateway, _mid);
			if (GlobalConfig.lanVersion != 6 && GlobalConfig.lanVersion != 7)
				FireDragonData.instance.init(gateway, _mid);
			StatisticsManager.initPostBase(gateway, _mid);
			m_actionSrvProxy = new GameActionCenter(gateway, _mid);
			m_trainingFieldProxy = new GameTrainingBase(gateway, _mid);
		}
		
		/**
		 * 检测公会名是否可用
		 * @param	name
		 */
		public function checkUnionName(name:String):void
		{
			_gameTable.checkUnionName(name);
		}
		
		/**
		 * 创建公会
		 * @param	obj
		 */
		public function createUnion(obj:Object):void
		{
			_gameTable.createUnion(obj);
		}
		
		/**
		 * 是否有公会
		 */
		public function isHaveUnion():void
		{
			_gameTable.isHaveUnion();
		}
		
		/**
		 * 获取公会列表
		 * @param	page
		 * @param	unionName
		 */
		public function getUnionList(obj:Object):void
		{
			_gameTable.getUnionList(obj);
		}
		
		/**
		 * 申请加入公会
		 */
		public function applyToUnion(cid:int):void
		{
			_gameTable.apply4Consortion(cid);
		}
		
		/**
		 * 获取申请/邀请信息
		 */
		public function getApplyUnionInfo():void
		{
			_gameTable.getApplyInfo();
		}
		
		/**
		 * 撤销公会申请
		 */
		public function cancelApplyUnion(cid:int):void
		{
			_gameTable.cancelApplyUnion(cid);
		}
		
		/**
		 * 邀请玩家进公会
		 * @param	mid
		 */
		public function invitePlayerToUnion(mid:int):void
		{
			_gameTable.invitePlayerToUnion(mid);
		}
		
		/**
		 * 公会被邀请处理
		 * @param	obj
		 */
		public function dealInvite(obj:Object):void
		{
			_gameTable.dealInvite(obj);
		}
		
		/**
		 * 编辑公会公告
		 * @param	str
		 */
		public function editUnionNotice(str:String):void
		{
			_gameTable.editUnionNotice(str);
		}
		
		/**
		 * 获取公会公告
		 */
		public function getUnionNotice():void	
		{
			_gameTable.getUnionNotice();
		}
		
		/**
		 * 捐献公会
		 * @param	pay
		 */
		public function endowUnion(arr:Array):void
		{
			//if(arr[1] == 2 || GlobalConfig.lanVersion != 1)
				_gameTable.endowUnion(arr);
			//else
			//{
				//if (ExternalInterface.available)
				//{
					//ExternalInterface.call("devote", arr[0], arr[1]);
				//}
			//}
		}
		
		/**
		 * 获取公会成员
		 */
		public function getUnionMember():void
		{
			_gameTable.getUnionMember();
		}
		
		/**
		 * 编辑公会头衔称号
		 * @param	obj
		 */
		public function editUnionPostionName(obj:Object):void
		{
			_gameTable.editUnionPositionName(obj);
		}
		
		/**
		 * 获取申请加入公会的玩家列表
		 */
		public function getNoUnionPlayers():void
		{
			_gameTable.getNoUnionPlayers();
		}
		
		/**
		 * 处理公会申请
		 * @param	arr
		 */
		public function dealUnionApply(arr:Array):void
		{
			_gameTable.dealUnionApply(arr);
		}
		
		/**
		 * 管理公会会员
		 * @param	arr
		 */
		public function manageUnionMember(arr:Array):void
		{
			_gameTable.manageUnionMember(arr);
		}
		
		/**
		 * 合并背包和仓库里的物品onlyID
		 * @param	arr
		 */
		public function combineUnionPorp(arr:Array):void
		{
			_gameTable.combineUnionProp(arr);
		}
		
		/**
		 * 公会升级
		 * @param	flag
		 */
		public function upUnionLevel(flag:int):void
		{
			_gameTable.upUnionLevel(flag);
		}
		
		/**
		 * 公会事件薄
		 * @param	obj
		 */
		public function unionThingsNote():void
		{
			_gameTable.unionThingsNote();
		}
		
		/**
		 * 编辑公会公告
		 * @param	str
		 */
		public function editUnionCdesc(str:String):void
		{
			_gameTable.editUnionCdesc(str);
		}
		
		/**
		 * 编辑公会限制
		 * @param	obj
		 */
		public function editUnionLimit(obj:Object):void
		{
			_gameTable.editUnionlimit(obj);
		}
		
		/**
		 * 工会设施总排行
		 */
		public function unionBuildRank():void
		{
			_gameTable.unionBuildRank();
		}
		
		/**
		 * 工会荣誉总排行
		 */
		public function unionHonorRank():void
		{
			_gameTable.unionHonorRank();
		}
		
		/**
		 * 工会改名卡
		 * @param	name
		 */
		public function changeUnionName(arr:Array):void
		{
			_gameTable.changeUnionName(arr);
		}
		
		public function consortionhonorlist(arr:Array):void
		{
			_gameAuction.consortionhonorlist(arr);
		}
		
		/**
		 * 获取中秋月饼盒
		 */
		public function getMoonBox():void
		{
			_gameTable.getMoonBox();
		}
		
		/**
		 *  切换背包和仓库
		 * @param	arr
		 */
		public function tostorage(arr:Array):void
		{
			if (GlobalConfig.KNSTEST)
				IMSocketManager.getIMSocketManager().tostorage(arr);
			else
				_gameGoods.tostorage(arr);
		}
		
		/**
		 * 获取万圣节礼盒
		 */
		public function getHallowmasBox():void
		{
			_gameTable.getHallowmasBox();
		}
		
		/**
		 *  兑换奖励
		 * @param	o
		 */
		public function exchange(o:Object):void
		{
			_activity.exchange(o);
		}
		
		/**
		 * 漫游下发feed
		 * @param	action
		 * @param	param
		 */
		public function manyoufeed(action:int, param:Object):void
		{
			_activity.manyoufeed(action, param);
		}
		
		/**
		 *  更新怕怕果
		 */
		public function getaucteCoin():void
		{
			_gameGoods.getaucteCoin();
		}
		
		/**
		 *  续费用。
		 * @param	onlyid
		 */
		public function getMemprop(onlyid:int):void
		{
			_gameGoods.getMemprop(onlyid);
		}
		
		/**
		 *  更新公会贡献
		 */
		public function getMemDevotes():void
		{
			_gameGoods.getMemDevotes();
		}
		
		public function getMemHelper():void
		{
			_gameMember.getMemHelper();
		}
		
		/**
		 *  发送新手教程步数
		 */
		public function newu(count:int):void
		{
			_gameMember.newu(count);
		}
		
		//冲榜
		public function getTopActivityTime():void
		{
			_gameAuction.getTopActivityTime();
		}
		
		//团购信息
		public function getBuyGroup():void
		{
			_gameAuction.getBuyGroup();
		}
		
		//团购
		public function getGroup():void
		{
			_gameAuction.getGroup();
		}
		
		/**
		 * 使用新手卡
		 * @param	str
		 */
		public function useNoviceCard(str:String):void
		{
			_gameMember.useNoviceCard(str);
		}
		
		/**
		 * 使用公会卡
		 * @param	str
		 */
		public function useConsortionCard(str:String):void
		{
			_gameMember.useConsortionCard(str);
		}
		
		 //泰语父亲节活动
		//public function getcardcode():void
		//{
			//_activity.getcardcode();
		//}
		
		// 查看自己贡献消费明细
		public function getDevoteDetail():void
		{
			_gameTable.getDevoteDetail();
		}
		
		// 腾讯高朋
		public function useGaoPengCard(str:String):void
		{
			_activity.useGaoPengCard(str);
		}
		// 圣诞
		public function getShopDiscountTop():void
		{
			_activity.getShopDiscountTop();
		}
		
		public function  goAntiAddiction():void
		{
			_gameMember.goAntiAddiction();
		}
		
		// 拿中心服务器
		public function getCenterSever():void
		{
			_gameMember.getCenterSever();
		}
		
		// IO错误写记录
		public function failloginlog(str:String):void
		{
			_gameMember.failloginlog(str);// GameMember.failloginlog
		}
		//新年活动
		public function getNewYear():void
		{
			_gameAuction.getNewYear();
		}
		//新年活动拿第一名
		public function getNewYearFirst():void
		{
			_gameAuction.getNewYearFirst();
		}
		//拿新年奖励
		public function getNewYearGift(num:int):void
		{
			_gameAuction.getNewYearGift(num);
		}
		
		//拿情人节活动数据
		public function getValentine():void
		{
			_gameTable.getValentine();
		}
		
		//领取情人节礼盒 
		public function getValentineBox(num:int):void
		{
			_gameTable.getValentineBox(num);
		}
		
		public function getFreeSend(num:int):void
		{
			_gameTable.getFreeSend(num);
		}
		
		public function getRose(num:int):void
		{
			_gameTable.getRose(num);
		}
		
		public function delFriends(arr:Array):void
		{
			_gameAuction.delFriends(arr);
		}
		
		public function loadThNewOneLimit():void
		{
			_activity.loadThNewOneLimit();
		}
		
		public function receiveNoviceGifts():void
		{
			_activity.receiveNoviceGifts();
		}
		public function receiveSacredGifts(onlyID:uint):void
		{
			_activity.receiveSacredGifts(onlyID); 
		}
		
		//拿好友的装备信息
		public function watchOthersProps(id:int):void
		{
			_gameAuction.watchOthersProps(id);
		}
		
		/**
		 * 单例引用
		 */
		public static function get instance():Remoting
		{
			if(_instance == null)
			{
				_instance = new Remoting(new Single());
			}
			return _instance;
		}
		
		/**
		 * 活动中心服务器代理
		 */
		public function get actionSrvProxy():GameActionCenter 
		{
			return m_actionSrvProxy;
		}
		
		/**
		 * 训练场的服务器端接口代理
		 */
		public function get trainingFieldSrv():GameTrainingBase 
		{
			return m_trainingFieldProxy;
		}
		
		private static var _instance:Remoting = null;
		
	}
	
}
class Single{}